package com.baidu.thirdlib.adpater;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.baidu.thirdlib.R;
import com.kvin.toolkit.adapter.BasicAdapter;

import java.util.List;

import butterknife.BindView;

/**
 * Created by Kvin on 2017/5/2.
 */
public class LibAdapter extends BasicAdapter<LibAdapter.ViewHolder, String> {


    public LibAdapter(List<String> list, Context context) {
        super(list, context);
    }

    @Override
    protected View getConvertView(LayoutInflater inflater, ViewGroup parent, Context context, List<String> list, int position) {
        return inflater.inflate(R.layout.adapter_lib, parent, false);
    }

    @Override
    protected ViewHolder initView(View cv, ViewGroup parent, Context context) {
        return new ViewHolder(cv);
    }

    @Override
    protected void bindData(ViewHolder vh, int position, List<String> list, Context context) {
        vh.libNameTv.setText(list.get(position));
    }

    static class ViewHolder extends BasicAdapter.ViewHolder {
        TextView libNameTv;

        public ViewHolder(View v) {
            super(v);
            libNameTv = (TextView) v.findViewById(R.id.lib_name_tv);

        }
    }
}
